package com.weitu.workflow.flowManagement.mapper;

import com.weitu.workflow.flowManagement.entity.WorkItemInfo;
import com.weitu.workflow.flowManagement.entity.WorkflowInstance;
import com.weitu.workflow.flowManagement.entity.WorkflowReview;
import com.weitu.workflow.flowManagement.entity.WorkflowTaskInstance;
import org.apache.ibatis.annotations.Param;
import org.fireflow.engine.definition.WorkflowDefinitionInfo;

import java.util.List;
import java.util.Map;

public interface FlowManagementMapper {

    /***
     * 根据业务id查询业务流程信息
     * @param businessId
     * @return
     */
    public WorkflowInstance queryWorkflowInstanceByBusinessId(String businessId);
    /***
     * 根据业务id查询业务流程实例
     * @param workItemId
     * @return
     */
    public WorkflowInstance queryWorkflowInstanceByWorkItemId(String workItemId);
    /***
     * 根据流程实例id查询任务实例集合
     * @param workflowInstanceId
     * @return List<WorkflowTaskInstance>
     */
    public List<WorkflowTaskInstance> queryTaskInstanceListByWorkflowId(String workflowInstanceId);
    /***
     * 根据任务实例id查询工作项集合
     * @param workflowTaskInstanceId
     * @return List<WorkItemInfo>
     */
    public List<WorkItemInfo> queryWorkItemInfoListByTaskInstanceId(String workflowTaskInstanceId);

    /***
     * 根据流程实例id查询业务描述
     * @param processInstanceId
     * @return
     */
    String queryBusinessContentByProcessInstanceId(String processInstanceId);

    /***
     * 新增流程实例业务描述
     * @param processInstanceId
     * @param businessContent
     * @return
     */
    boolean insetProcessInstanceBusinessContent(@Param("processInstanceId")String processInstanceId,@Param("businessContent") String businessContent);

    /***
     * 更新流程实例业务描述
     * @param processInstanceId
     * @param businessContent
     * @return
     */
    boolean updateProcessInstanceBusinessContent(@Param("processInstanceId")String processInstanceId,@Param("businessContent") String businessContent);
    /***
     * 根据工作项id查询工作流处理意见
     * @param workItemId
     * @return
     */
    public WorkflowReview queryWorkflowReviewByWorkItemId(String workItemId);

    /***
     * 根据用户名查询工作数量
     * @param paramMap
     * @return
     */
    public int queryWorkItemCount(Map<String,Object> paramMap);
    /***
     * 根据用户名查询工作事项
     * @param paramMap
     * @return
     */
    public List<WorkItemInfo> queryWorkItemList(Map<String,Object> paramMap);

    /***
     * 根据工作项id查询工作项信息
     * @param workItemId
     * @return
     */
    public WorkItemInfo queryWorkItemInfoByWorkItemId(String workItemId);
    /***
     * 根据业务标识查询流程定义信息
     * @param businessIdentity
     * @return
     */
    WorkflowDefinitionInfo queryWorkflowDefinitionInfoByBusinessIdentity(String businessIdentity);
    /***
     * 保存处理结果
     * @param workflowReview
     * @return
     */
    boolean saveWorkflowReview(WorkflowReview workflowReview);
}

